﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DHQGHN.DAL.BO;
using DHQGHN.DAL.Models;

namespace DHQGHN.PM0.Common.Helpers
{
    public static class GetMenuHelper
    {
        public const String MenuHelperKey = "MenuHelperKey";
        public static List<AdminMenuModel> GetAllMenu()
        {
            List<AdminMenuModel> listMenu = null;
            if (HttpContext.Current.Session[MenuHelperKey] != null)
            {
                listMenu = (List<AdminMenuModel>)HttpContext.Current.Session[MenuHelperKey];
            }
            else
            {
                AdminMenuBO bo = new AdminMenuBO();

                listMenu = bo.GetAll();
                HttpContext.Current.Session[MenuHelperKey]=listMenu;
            }
            return listMenu;
        }
    }
}